import React from 'react';
import {
    StyleSheet,
    View,
    Modal
} from 'react-native';

import colors from './colors'
import Spinner from 'react-native-spinkit'


export default class LoadingModal extends React.Component {

    onRequestClose = () => {

    }

    render() {

        return (
            <Modal
                animationType="none"
                transparent={true}
                visible={this.props.isOpen}
                onRequestClose={()=> this.onRequestClose()}
            >
                <View style={styles.loadingBox}>
                    <Spinner  size={50} isVisible={this.props.isOpen} type={"Wave"} color={colors.primaryColor} />
                </View>
            </Modal>
        );
    }

}

const styles = StyleSheet.create({
    loadingBox: {
        flex: 1,
        alignItems: 'center',
        justifyContent: 'center',
        backgroundColor: 'rgba(0, 0, 0, 0.1)', // 半透明
    },
});